﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            MyList list = new MyList();
            list.Add(10);
            list.Add(20);
            list.Add(30);
            list.Add(40);
            list.Add(50);
        }
      
    }
    class Node
    {
        public int data;
        public Node next;
        public   Node()
        {
            data = 0;
            next = null;
        }
         ~Node()
        {

        }
       
    }
    class MyList
    {
        public Node m_node;//头结点
       
        public MyList()
        {
            m_node = new Node();
        }
        public void Add(int value)
        {
            Node node = new Node();
            node.data = value;
            FindEnd(m_node).next = node;
        }
        public Node FindEnd(Node head)
        {

            if (head.next!=null)
            {
                Node nextnode = head.next;
                return  FindEnd(nextnode);
               
            }
            return head;

        }
        ~MyList()
        {

        }

    }

}
